<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>${activity.title}</title>
    <link rel="stylesheet" href="${ctx}/resources/yb/style/weui/weui.min.css" />
    <link rel="stylesheet" href="${ctx}/resources/yb/style/weui/example.css" />
    <link rel="stylesheet" href="${ctx}/resources/yb/style/weui/weuiNew.min.css" />
    <link rel="stylesheet" href="${ctx}/resources/yb/style/weui/plus.css" />


    <script src="http://cdn.bootcss.com/jquery/1.8.3/jquery.js"></script>
    <script src="${ctx}/resources/yb/js/app.js"></script>
    <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script src="${ctx}/resources/yb/js/wechat.api.js"></script>
    <meta name="format-detection" content="telephone=no" />
    <style type="text/css">
        section {
            max-width: 100%;
        }
    </style>
</head>
<body>
<script>
    $(function () {
        var url = window.location.href;
        url = url.replace(/&/g, "%26");
        $.ajax({
            url: '/OAuth/WxShare?url=' + url,
            type: 'POST',
            dataType: 'json',
            success: function (data) {
                wx.config({
                    debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。  //appId: "wx8c534c995ee68d7e", // 必填，公众号的唯一标识
                    appId: data.AppId, // 必填，公众号的唯一标识
                    timestamp: data.Timestamp, // 必填，生成签名的时间戳
                    nonceStr: data.NonceStr, // 必填，生成签名的随机串
                    signature: data.Signature, // 必填，签名，见附录1
                    jsApiList: [
                        'onMenuShareAppMessage',
                        'onMenuShareTimeline',
                        'hideOptionMenu',
                        'showOptionMenu',
                        'showMenuItems',
                        'hideMenuItems',
                        'openLocation'
                    ] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
                });
            }
        });
        WeChat.hideOptionMenu();
    })
</script>



<script>
//    $(function () {
//        $.ajax({
//            type: 'get',
//            url: 'https://open.zhundao.net/api/PerBase/UpdateActivityClickNo?activityId=85281',
//            success: function () {
//            },
//            dataType: 'json'
//        });
//    })
</script>
<style>

</style>
<div id="wxshare" data-title="${activity.title}"
     data-desc="赶快报名参加${activity.title}"
     data-img="${activity.activitysImg}"></div>
<div class="page slideIn cell ActivityDetail">
    <div id="scroller">
        <div class="">
            <img class="topimg" src="${activity.activitysImg}">
        </div>
        <div class="bd">
            <div class="weui_panel weui_panel_access">
                <div class="bd">
                    <div class="weui_cells proTable">
                        <header>
                            <h1>${activity.title}</h1>
                            <div class="ul">
                                <div class="f1">已报名 <span class="brownC">${userCount}</span></div>
                                <div></div>
                            </div>
                        </header>
                        <div class="Bborder">
                            <div class="weui_cell ">
                                <div class="weui_cell_hd">
                                    <i class="iconfont icon-clock "></i>
                                </div>
                                <div class="weui_cell_bd weui_cell_primary ft15">

                                    <p>${activity.beginTime}</p>
                                    <%--<p class="ui-txt-muted h5">--%>
                                        <%--（2018年05月18日 13:45截止报名）--%>
                                    <%--</p>--%>
                                </div>
                            </div>
                            <div class="weui_cell">
                                <div class="weui_cell_hd">
                                    <i class="iconfont icon-location "></i>
                                </div>
                                <div class="weui_cell_bd weui_cell_primary ft15">
                                    <p>
                                        ${activity.hallName}                                  </p>
                                </div>
                            </div>
                        </div>
                    </div>
                    <article class="weui_article detailContent">
                        <section class="">
                           ${activity.content}
                        </section>
                        <!--<a href="/Activity/Report?adminUserId=2296746" class="jubao">投诉</a>-->
                    </article>
                </div>
            </div>


            <div class="weui_panel weui_panel_access">
                <div class="bd">
                    <div class="weui_panel_access">
                        <div class="weui_panel_bd">
                            <a class="weui_panel_ft borderNone" >已报名 <span class="brownC">${userCount}</span></a>
                            <div class="weui_panel_bd   peopleList1 weui_media_box weui_media_appmsg " id="actBox">
                                <script src="http://cdn.bootcss.com/mustache.js/2.2.1/mustache.min.js "></script>
                                <script type="text/template" id="actlistTemplate">
                                    <a href="javascript:;">
                                        <div class="img">
                                            <img class="weui_media_appmsg_thumb" src="{{HeadImgurl}}" alt="">
                                        </div>
                                        <div class="title">
                                            {{Name}}
                                        </div>
                                    </a>
                                </script>
                                <script>
                                    $(function () {
                                        $.get("${ctx}/mobileActivity/GetActivityUserList?activityId=${activity.id}",
                                            function (data) {
                                                var content = "{{#list}}" + $("#actlistTemplate").html() +"{{/list}}";
                                                var output = Mustache.render(content,data);
                                                $("#actBox").append(output);
                                            });

                                    })
                                </script>

                            </div>
                        </div>
                    </div>
                </div>

            </div>

            <%--<div class="liuyan">--%>
            <%--</div>--%>
            <!--<div class="copyRight">-->
                <!--<img src = "https://joinheadoss.oss-cn-hangzhou.aliyuncs.com/qinglong/Static/zhundao/logo.png"/><p>准到提供技术支持</p>-->
                <!--<div style="height: 56px;"></div>-->
            <!--</div>-->
        </div>
    </div>
</div>

<div class="footerBtn">
    <div class="weui_btn_area ul">

        <div class="btnBox f1">
            <c:choose>
                <c:when test="${userId!=null}">
                    <a class=" weui-btn weui_btn_s weui-btn_primary" href="${ctx}/mobileActivity/toJoinDetail/${activity.id}/user${userId}">查看报名</a>
                </c:when>
                <c:otherwise>
                    <a href="${ctx}/mobileActivity/toSignUp/${activity.id}" class=" weui_btn weui_btn_s weui_btn_primary">报名</a>
                </c:otherwise>
            </c:choose>
            <!--<a href="/Activity/SubmitActivity/85281" class=" weui_btn weui_btn_s weui_btn_primary">报名</a>-->
        </div>
        <!--<div class="btnBox">-->
            <!--<a href="/Activity/SubmitConsult?id=85281" class="weui_btn weui_btn_s weui_btn_primary"> 咨 询 </a>-->
        <!--</div>-->
    </div>
</div>
<script src="http://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>

<link rel="stylesheet" href="${ctx}/resources/yb/Scripts/photoswipe/photoswipe.css">
<script src="${ctx}/resources/yb/Scripts/photoswipe/klass.min.js"></script>
<script src="${ctx}/resources/yb/Scripts/photoswipe/code.photoswipe.jquery-3.0.5.min.js"></script>

<script>
//    function mapGo() {
//        var ua = navigator.userAgent.toLowerCase();
//        var isWeixin = ua.indexOf('micromessenger') != -1;
//        if (isWeixin) {
//            function gg(t,n){var o = 3e3 * Math.PI / 180;var e=t-.0065,i=n-.006,r=Math.sqrt(e*e+i*i)-2e-5*Math.sin(i*o),a=Math.atan2(i,e)-3e-6*Math.cos(e*o);return{lng:r*Math.cos(a),lat:r*Math.sin(a)}}
//            var gps=gg(0,0)
//            wx.openLocation({
//                latitude: gps.lat,
//                longitude:gps.lng,
//                name: '北京',
//                address: '北京',
//                scale: 16,
//                infoUrl: 'http://weixin.qq.com',
//                fail: function () {
//                    window.location.href = "http://m.zhundao.net/html/mapgo.html?lng=0&lat=0";
//                },
//                cancel: function () {
//                }
//            })
//            return;
//        }
//        window.location.href = "http://m.zhundao.net/html/mapgo.html?lng=0&lat=0";
//    }


    $(function () {
        var cookName = 'tg_${activity.id}';
        var tgid = '';
        if (tgid != '') {
            $.post('/Spread/CountClickNumber/?id=${activity.id}', function (data) {

            }, 'json');
            if ($.cookie(cookName) == undefined || $.cookie(cookName) == '') {
                $.cookie(cookName, '', { expires: 30, path: '/' });
            }
        }
        WeChat.shareMenu();
        <%--$('#payFee').click(function () {--%>
            <%--$.ajax({--%>
                <%--type: 'POST',--%>
                <%--url: '/activity/PayActivityFee/${activity.id}',--%>
                <%--beforeSend: function () {--%>
                    <%--App.showLoading();--%>
                <%--},--%>
                <%--dataType: "json",--%>
                <%--success: onSuccess--%>
            <%--});--%>
        <%--});--%>
        $.post('/NoUserIno/recordTrack?activityId=${activity.id}&track=&userId=0');
    });
</script>


<script>
    $(document).ready(function () {

        var ua = window.navigator.userAgent.toLowerCase();
        if (ua.match(/MicroMessenger/i) != 'micromessenger') {
            $('.detailContent img').each(function () {
                var href = $(this).attr('src');
                $(this).wrap('<a class="swipeA" href="' + href + '"></a>');
            });


            var myPhotoSwipe = $(".detailContent  .swipeA").photoSwipe({
                enableMouseWheel: false,
                enableKeyboard: false,
                //captionAndToolbarHide: true,
                tapToClose: true,
            });
            return;
        }



        function wxReadyFunc() {
            var imgList = [];
            $('.detailContent img').each(function () {
                var href = $(this).attr('src');
                imgList.push(href);
            });

            $('.detailContent img').click(function () {
                var cur = $(this).attr('src');

                wx.previewImage({
                    current: cur,
                    urls: imgList
                });

            });
        }

        if (typeof window.WeixinJSBridge == "undefined") {
            if (document.addEventListener) {
                document.addEventListener('WeixinJSBridgeReady', wxReadyFunc, false);
            } else if (document.attachEvent) {
                document.attachEvent('WeixinJSBridgeReady', wxReadyFunc);
                document.attachEvent('onWeixinJSBridgeReady', wxReadyFunc);
            }
        } else {
            wxReadyFunc();
        }
    });
</script>

<%--<script type="text//javascript" src="https://pingjs.qq.com/h5/stats.js" name="MTAH5" sid="500049665"></script>--%>
</body>
</html>
